package com.sskj.mine.asset;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.mine.asset.data.AssetBean;
import com.sskj.mine.asset.data.AssetMainBean;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.presenter.BasePresenter;


/**
 * @author Hey
 * Create at  2019/05/03
 */
class AssetHomePresenter extends BasePresenter<AssetHomeFragment> {


    /**
     * 资产管理 首页
     *
     * @return
     */
    public void getAssetMainList() {
        httpService.getAssetMainList().execute(new JsonCallBack<HttpData<PageBean<AssetBean>>>() {
            @Override
            public void onSuccess(Response<HttpData<PageBean<AssetBean>>> response) {
                HttpData<PageBean<AssetBean>> httpData = response.body();
                if (httpData.getStatus() == HttpConfig.OK) {
                    mView.updateList(httpData.getData().getList());
                }
            }
        });
    }

    /**
     * 资产管理 首页
     *
     * @return
     */
    public void getAssetMain() {
        httpService.getAssetMain().execute(new JsonCallBack<HttpData<AssetMainBean>>() {
            @Override
            public void onSuccess(Response<HttpData<AssetMainBean>> response) {
                HttpData<AssetMainBean> httpData = response.body();
                if (httpData.getStatus() == HttpConfig.OK) {

                    mView.updateUI(httpData.getData());
                }
            }
        });
    }
}
